<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>opacity rgba</title>
</head>
<style>
    .box1{
        width:100px;
        height:100px;
        background-color: gray;
        opacity:0.5;
    }


    .box2{
        width:50px;
        height: 50px;
        background-color: pink;
    }


    .box3{
        width:100px;
        height:100px;
        background-color: rgba(95, 68, 68, 0.5);
    }


    .box4{
        width:50px;
        height: 50px;
        background-color: pink;
    }
</style>
<body>
    <!-- 
        opacity会继承父元素的 opacity 属性，而rgba设置元素的后代元素不会继承不透明属性
     -->
     <!-- opacity -->
     <div class="box1">
         <div class="box2"></div>
     </div>

     <!-- rgba -->
     <div class="box3">
        <div class="box4"></div>
    </div>
</body>
</html>